#include <buola/chart/caxis.h>

#include <buola/chart/mappings/clinearmapping.h>

namespace buola { namespace chart {

CAxis::CAxis()
{
    mAutoScale=true;
    mMark.mEnabled=false;
    mMapping=new CLinearMapping();
}

CAxis::~CAxis()
{
    delete mMapping;
}

void CAxis::SetMapping(CMapping *pMapping)
{
    if(mMapping==pMapping) return;
    delete mMapping;
    mMapping=pMapping;
}

void CAxis::SetLimits(double pMin,double pMax)
{
    mMapping->SetSrcLimits(pMin,pMax);
    mAutoScale=false;
}

void CAxis::SetAutoScale(bool pAuto)
{
    mAutoScale=pAuto;
}

void CAxis::SetTitle(const std::wstring &pTitle)
{
    mTitle=pTitle;
}

void CAxis::SetLabelNames(const std::vector<std::wstring> &pNames)
{
    mLabelNames=pNames;
}

void CAxis::SetMark(double pPos)
{
    mMark.mEnabled=true;
    mMark.mPos=pPos;
}

void CAxis::RemoveMark()
{
    mMark.mEnabled=false;
}

/*namespace chart*/ } /*namespace buola*/ }
